<dl>
    <dt><?php echo $lang['store_goods_index_goods_class'] . $lang['nc_colon']; ?></dt>
    <dd id="gcategory"> <?php echo $output['goods_class']['gc_tag_name']; ?> <a class="ncsc-btn"
                                                                                href="<?php if ($output['edit_goods_sign']) {
                                                                                    echo urlShop('store_goods_online', 'edit_class', array(
                                                                                        'commonid' => $output['goods']['goods_commonid'],
                                                                                        'ref_url'  => getReferer()
                                                                                    ));
                                                                                } else {
                                                                                    echo urlShop('store_goods_add', 'add_step_one');
                                                                                } ?>"><?php echo $lang['nc_edit']; ?></a>
        <input type="hidden" id="cate_id" name="cate_id" value="<?php echo $output['goods_class']['gc_id']; ?>"
               class="text"/>
        <input type="hidden" name="cate_name" value="<?php echo $output['goods_class']['gc_tag_name']; ?>"
               class="text"/>
    </dd>
</dl>
<?php

    $model_setting = Model('setting');
    $config = $model_setting->getListSetting();
    if ($config['open_tax'] == 1) {

        ?>
        <dl>
            <dt>
                <i class="required">*</i>
                商品类别：
            </dt>
            <dd>
                <?php
                    if(isset($output['goods']['goods_commonid'])){
                        $gminfo = ml('goods_common')->find($output['goods']['goods_commonid']);
                    }
                    else{
                        $gminfo = [];
                    }
                    if (isset($output['goods']['open_tax'])) {
                        echo $output['goods']['open_tax'] == 0 ? '国内完税商品' : "保税商品";
                        if($gminfo['is_zhiyou'] == 1){
                            echo "(直邮)";
                        }
                    }
                ?>

                <ul class="ncsc-form-radio-list" style='<?php if (isset($output['goods']['open_tax'])) {
                    echo "display:none;";
                } ?>'>
                    <li>
                        <label>
                            <input name="goods_type" class="radio" type="radio" value="0">
                            国内完税商品
                        </label>
                    </li>
                    <?php
                        $sinfo = Model('store')->where(array('member_id' => $_SESSION['member_id']))->find();
                        if (!empty($sinfo['ebcName'])) {
                            ?>
                            <li>
                                <label><input name="goods_type" class="radio" type="radio"
                                      <?php if ($output['goods']['open_tax'] > 0){ ?>checked="checked"<?php } ?>
                                      value="1">
                                    保税商品</label>
                            </li>
                            <?php
                        }
                    ?>
                    <li>
                        <label>
                            <input name="goods_type" class="radio" type="radio" value="2">
                            直邮商品
                        </label>
                    </li>
                </ul>


                <script>
                    $('[name=goods_type]').click(function () {
                        if (this.value == 1 || this.value == 2 && this.checked) {
                            $('.goodsextends').slideDown();
                            $('.hint-tax').siblings('.hint').hide();
                            $('.hint-tax').show();
                        }
                        else if (this.value == 0 && this.checked) {
                            $('.goodsextends').slideUp();
                            $('.hint-tax').siblings('.hint').show();
                            $('.hint-tax').hide();
                        }
                    });
                </script>
                <span></span>

                <p class="hint">商品类别一经确定无法修改，请谨慎选择</p>
            </dd>

        </dl>

        <?php
        ?>


        <script>
            (function () {
                function init() {
                    $('option[from_place]').show();
                }

                $('#place').change(function () {
                    var val = this.value;
                    if (val == -1) {
                        init();
                        // $('#_result').hide();
                    }
                    else {
                        $('option[from_place]').hide();
                        $('#sel_brand option:first').show().attr('selected', 'selected').siblings().removeAttr('selected');
                        $('option[from_place=' + val + ']').show();
                    }
                });

                $(function () {
                    var target = '<?php echo $output['goods']['from_place']?>';
                    if (Number(target) > 0) {
                        $('[name=from_place]').val(target).find('option[value=' + target + ']').attr('selected', 'selected').siblings().removeAttr('selected').trigger('change');
                        $('#sel_brand').val(<?php echo $output['goods']['brand_id']?>).find('option[value=' + <?php echo $output['goods']['brand_id']?> +']').attr('selected', 'selected').siblings().removeAttr('selected').trigger('change');
                    }
                });

            })();


        </script>

        <div style='display: none!important;'>
            <dl class='_margin goodsextends'>
                <dt>
                    <i class="required">*</i>
                    商品税率：
                </dt>
                <dd nc_type="no_spec">
                    <input name="margin" value="<?php echo $output['goods']['tax']; ?>" type="text" class="text w60"><em
                        class="add-on">%</em>
                    <span></span>

                    <p class="hint">税率必须在0%-100%之间，填写0即视为完税产品，请按照相关规定进行设置。</p>
                </dd>
            </dl>
            <script>
                $(function () {
                    $(document).on("change", '[name=codeTs]', function () {
                        var val = $(this).find('option[value=' + this.value + ']').text();
                        var rate = val.match(/(\d+)%/)[1];
                        $('[name=margin]').val(rate);
                    });
                });
            </script>
        </div>


        <div id='_result'>
            <?php
                if ($config['custom_interface'] == 'shenzhen') {
                    ?>
                    <link rel="stylesheet" href="/static/webuploader/webuploader.css">
                    <style>
                        .webuploader-pick {
                            height: 30px;
                            padding: 0 15px;
                        }

                        .sel, .sel2 {
                            width: 60px;
                            height: 30px;
                        }

                        .sel input, .sel div, .sel2 input, .sel2 div {
                            display: block;
                            width: 60px;
                            height: 30px;
                        }

                        .file-item {
                            overflow: hidden;
                            margin-bottom: 5px;
                        }

                        .file-item .info {
                            float: left;
                            margin-right: 10px;
                        }

                        .image_list {
                            padding-top: 10px;
                        }

                        .file_list {
                            padding-top: 10px;
                        }

                    </style>
                    <script src='/static/webuploader/webuploader.min.js'></script>



                    <script>
                        var BASE_URL = '/static/webuploader';
                        (function () {
                            var uploader = WebUploader.create({

                                // swf文件路径
                                swf: BASE_URL + '/Uploader.swf',
                                // 文件接收服务端。
                                server: '/static/webuploader/fileupload.php',
                                // 选择文件的按钮。可选。
                                // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                                pick: '.sel',
                                // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
                                resize: false,

                                auto: true,

                                accept: {
                                    title: 'Images',
                                    extensions: 'gif,jpg,jpeg,bmp,png',
                                    mimeTypes: 'image/*'
                                }
                            });

                            var $list = $('.image_list');

                            uploader.on('fileQueued', function (file) {

                                var $li = $(
                                        '<div id="' + file.id + '" class="file-item thumbnail">' +
                                        '<div class="info"><a href="javascript:;"><img></a></div>' +
                                        '<div class="info" style="padding-top:5px"><select name="pictype[]"><option value="1">正面</option><option value="2">背面</option><option value="3">侧面</option><option value="4">标签</option></select></div>' +
                                        '<div class="info uploading" style="padding-top:5px">上传中……</div>' +
                                        '<div class="info" style="padding-top:5px;"><input type="hidden" name="pics[]"/><a href="javascript:;" class="_remove">删除</a>' + '</div>' +
                                        '</div>'
                                    ),
                                    $img = $li.find('img');


                                // $list为容器jQuery实例
                                $list.append($li);

                                // 创建缩略图
                                // 如果为非图片文件，可以不用调用此方法。
                                // thumbnailWidth x thumbnailHeight 为 100 x 100
                                uploader.makeThumb(file, function (error, src) {
                                    if (error) {
                                        $img.replaceWith('<span>不能预览</span>');
                                        return;
                                    }

                                    $img.attr('src', src);
                                }, 50, 50);
                            });

                            uploader.on('uploadSuccess', function (file, response) {
                                $('#' + file.id).find('a:first').attr({
                                    href: '/static/webuploader/' + response.result,
                                    target: '_blank'
                                })
                                $('#' + file.id).find('.uploading').text('上传成功');
                                // $( '#'+file.id ).find('.info:first').text(file.name);
                                $('#' + file.id).find('.info input[type=hidden]').val('/static/webuploader/' + response.result);
                            });
                            uploader.on('uploadError', function (file) {
                                alert('上传出错！');
                                $('#' + file.id).remove();
                            });

                            $(document).on('click', '._remove', function () {
                                $(this).closest('.file-item').remove();
                            })

                        })();
                    </script>

                    <script>
                        (function () {
                            var uploader = WebUploader.create({

                                // swf文件路径
                                swf: BASE_URL + '/Uploader.swf',
                                // 文件接收服务端。
                                server: '/static/webuploader/fileupload.php',
                                // 选择文件的按钮。可选。
                                // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                                pick: '.sel2',
                                // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
                                resize: false,

                                auto: true
                            });

                            var $list = $('.file_list');

                            uploader.on('fileQueued', function (file) {

                                var $li = $(
                                    '<div id="' + file.id + '" class="file-item thumbnail">' +
                                    '<div class="info"><a href="javascript:;"></a></div>' +
                                    '<div class="info" style="padding-top:5px"><select name="filetype[]"><option value="01">第三方检测报告</option><option value="02">原产国（地区）自由销售证明</option><option value="03">3C认证证书</option><option value="04">3C无需办理证明</option><option value="05">3C免办证明（手册）</option><option value="06">技术说明（3C目录外）</option><option value="07">中检界定结果（3C目录外）</option><option value="08">检验检疫界定结果（3C目录外）</option><option value="09">进口保健食品批准证书</option><option value="10">原产地证明</option><option value="11">婴幼儿乳粉的全项目检测报告</option><option value="12">化妆品备案凭证</option><option value="13">食品新品种、新原料的进口许可</option><option value="14">食品/化妆品相关证明材料（如产品成分、原料及配比、加工工艺说明等）</option><option value="15">《入/出境特殊物品卫生检疫审批单》</option><option value="16">《行政许可申请不予受理决定书》 </option><option value="99">其他</option></select></div>' +
                                    '<div class="info uploading" style="padding-top:5px">上传中……</div>' +
                                    '<div class="info" style="padding-top:5px;"><input type="hidden" name="files[]"/><a href="javascript:;" class="_remove">删除</a>' + '</div>' +
                                    '</div>'
                                );
                                $li.find('a:first').text(file.name);

                                // $list为容器jQuery实例
                                $list.append($li);

                            });

                            uploader.on('uploadSuccess', function (file, response) {
                                $('#' + file.id).find('a:first').attr({
                                    href: '/static/webuploader/' + response.result,
                                    target: '_blank'
                                })
                                $('#' + file.id).find('.uploading').text('上传成功');
                                // $( '#'+file.id ).find('.info:first').text(file.name);
                                $('#' + file.id).find('.info input[type=hidden]').val('/static/webuploader/' + response.result);
                            });
                            uploader.on('uploadError', function (file) {
                                alert('上传出错！');
                                $('#' + file.id).remove();
                            });
                        })();
                    </script>


                    <?php
                }
            ?>

        </div>


        <script>
            (function () {
                //@tag
                <?php
                  $base = dirname(BASE_PATH);
                  require_once $base . '/custom/'.$config['custom_interface'].'/controller.php';
                  $class = $config['custom_interface'] . 'Controller';
                  $custom = new $class;

                ?>
                var config = <?php echo json_encode($custom->get_form('goods'))?>;
//                console.log(config)
                var linkarr = [];
                for (var i in config) {
                    var item = config[i];
                    var base = $('._margin').clone().removeClass('_margin');
                    if (!is(item, 'object') || is(item, "array")) {
                        continue;
                    }
                    var input;

                    if (item.type) {
                        switch (item.type) {
                            case 'text':
                                input = $('<input>').attr({
                                    'class': 'text w400',
                                    'type': 'text',
                                    'name': i
                                });
                                if(item.limit){
                                    if(item.limit.length){
                                        input.attr("maxlength",item.limit.length);
                                    }
                                }
                                if(item.value){
                                    input.attr("value", item.value);
                                }
                                break;

                            case 'select':
                                input = $('<select>').attr({
                                    'name': i
                                });
                                input.append('<option value="">请选择</option>');
                                if (item.options) {
                                    for (var j in item.options) {
                                        if(item.value && item.value==j){
                                            input.append("<option value='" + j + "' selected>" + item.options[j] + "</option>")
                                        }else{
                                            input.append("<option value='" + j + "'>" + item.options[j] + "</option>")
                                        }

                                    }
                                }
                                break;
                            case 'upload':
                                input = $('<input>').attr({
                                    'name': i,
                                    "type": "file"
                                    // "class" : ""
                                });
                                break;


                            case 'hidden':
                                input = $('<input type="hidden" name="' + i + '" />');
                                break;
                        }
                    }

                    if (item.name) {
                        if (item.empty == true) {
                            base.find('dt').html(item.name + '：');
                        }
                        else {
                            base.find('dt').html('<i class="required">*</i>' + item.name + '：');
                        }
                    }
                    else {
                        base.find('dt').empty();
                    }
                    base.find('p.hint').empty();
                    if (item.tip) {
                        base.find('p.hint').html(item.tip);
                    }
                    base.find('dd').find('input,em').remove();
                    if (input) {
                        input.insertBefore(base.find('span'));
                        if (item.after) {
                            $('<em class="add-on">' + item.after + '</em>').insertAfter(input);
                        }

                        if (item.link) {
                            linkarr.push({
                                'source': i,
                                'target': item.link
                            })
                        }
                    }
                    if (item.type == 'hidden') {
                        $('#_result').append(input);
                    } else {
                        $('#_result').append(base);
                    }

                    if(item.tips){
                        $("<p>").attr({
                            'class' : 'hint'
                        }).text(item.tips).insertAfter(input);
                    }
                }

                var getValue = function (arr, name) {
                    var item = $('[name=' + arr[0] + ']');

                    item.change(function () {
                        if (arr[1] == 'text') {
                            if (item[0].tagName == 'SELECT') {
                                var val = item.find('option:selected').text();
                            }
                            else {
                                var val = item.text();
                            }
                        }
                        else {
                            var val = item[0].value;
                        }
                        $('[name=' + name + ']').val(val);
                    });
                }

                for (var i = 0; i < linkarr.length; i++) {
                    var target = linkarr[i].target;
                    if (target.indexOf('.')) {
                        var arr = target.split('.');
                        getValue(arr, linkarr[i].source)

                    }
                }


            })();

            function is(o, type) {
                var isnan = {"NaN": 1, "Infinity": 1, "-Infinity": 1}
                type = type.toLowerCase();

                // {"NaN": 1, "Infinity": 1, "-Infinity": 1}.hasOwnProperty(2)   -> false
                // {"NaN": 1, "Infinity": 1, "-Infinity": 1}.hasOwnProperty(NaN) -> true
                if (type == "finite") {
                    return !isnan["hasOwnProperty"](+o);
                }
                if (type == "array") {
                    return o instanceof Array;
                }
                return (type == "null" && o === null) ||
                        // is(undefined,'undefined')
                    (type == typeof o && o !== null) ||
                        // Object(Object) == Object -> true
                        // Object({}) == {}         -> false
                    (type == "object" && o === Object(o)) ||
                    (type == "array" && Array.isArray && Array.isArray(o)) ||
                    Object.prototype.toString.call(o).slice(8, -1).toLowerCase() == type;
            }
        </script>



      <!--<script>
        <?php
/*            if (isset($output['goods']['gextends'])) {
                $output['goods']['gextends'] = unserialize($output['goods']['gextends']);
            }
            $gdata = json_encode($output['goods']);
            if (isset($output['goods']['goods_commonid'])) {
                */?>
        var gdata = <?php /*echo $gdata */?>
        <?php
/*            }
        */?>
      </script>
      <script src='/data/resource/js/goodsextends.js'></script>-->
        <?php
        $_m = Model();
        $ginfo = $_m->table('custom_' . $config['custom_interface'] . '_goods')->where(array('goods_commonid' => $output['goods']['goods_commonid']))->find();
        ?>
        <script>
            $('[name=goods_type]:checked').trigger('click');
            var ginfo = <?php echo json_encode($ginfo)?>;
            if (ginfo) {
                for (var i in ginfo) {
                    console.log(i,ginfo[i])
                    var item = $('#_result [name=' + i + ']');
                    if (!item.length) {
                        continue;
                    }
                    if (item[0].tagName == 'SELECT') {
                        item.find('option[value=' + ginfo[i] + ']').attr('selected', 'selected').siblings().removeAttr('selected');
                    }
                    else {
                        item.val(ginfo[i]);
                    }
                }
            }

            var image_list = eval('(' + ginfo.ImageList + ')');
            var base = $('<div class="file-item thumbnail">' +
                '<div class="info"><a href="javascript:;"><img></a></div>' +
                '<div class="info" style="padding-top:5px"><select name="pictype[]"><option value="1">正面</option><option value="2">背面</option><option value="3">侧面</option><option value="4">标签</option></select></div>' +
                '<div class="info" style="padding-top:5px;"><input type="hidden" name="pics[]"/><a href="javascript:;" class="_remove">删除</a>' + '</div>' +
                '</div>');
            for (var i in image_list) {
                var cl = base.clone();
                // alert(image_list[i].image)
                cl.find('img').attr('src', image_list[i].image).css({width: 50, height: 50});
                cl.find('select option[value=' + image_list[i].imageType + ']').attr('selected', 'selected');
                cl.find('input[name="pics[]"]').val(image_list[i].image);
                $('.image_list').append(cl);
                // image_list.find
            }
            var image_list = eval('(' + ginfo.AttachmentList + ')');
            var base = $(
                '<div class="file-item thumbnail">' +
                '<div class="info"><a href="javascript:;"></a></div>' +
                '<div class="info" style="padding-top:5px"><select name="filetype[]"><option value="01">第三方检测报告</option><option value="02">原产国（地区）自由销售证明</option><option value="03">3C认证证书</option><option value="04">3C无需办理证明</option><option value="05">3C免办证明（手册）</option><option value="06">技术说明（3C目录外）</option><option value="07">中检界定结果（3C目录外）</option><option value="08">检验检疫界定结果（3C目录外）</option><option value="09">进口保健食品批准证书</option><option value="10">原产地证明</option><option value="11">婴幼儿乳粉的全项目检测报告</option><option value="12">化妆品备案凭证</option><option value="13">食品新品种、新原料的进口许可</option><option value="14">食品/化妆品相关证明材料（如产品成分、原料及配比、加工工艺说明等）</option><option value="15">《入/出境特殊物品卫生检疫审批单》</option><option value="16">《行政许可申请不予受理决定书》 </option><option value="99">其他</option></select></div>' +
                '<div class="info" style="padding-top:5px;"><input type="hidden" name="files[]"/><a href="javascript:;" class="_remove">删除</a>' + '</div>' +
                '</div>'
            );
            for (var i in image_list) {
                var cl = base.clone();
                // alert(image_list[i].image)
                cl.find('a:first').text(image_list[i].attachment.match(/[^\/]+$/));
                cl.find('select option[value=' + image_list[i].attachmentType + ']').attr('selected', 'selected');
                cl.find('input[name="files[]"]').val(image_list[i].attachment);
                $('.file_list').append(cl);
                // image_list.find
            }

            $('#_result').find('input,select').trigger('change');
        </script>

    <?php } ?>

<dl>
    <dt><i class="required">*</i><?php echo $lang['store_goods_index_goods_name'] . $lang['nc_colon']; ?></dt>
    <dd>
        <input name="g_name" id='goods_name' type="text" maxlength="50" class="text w400"
               value="<?php echo $output['goods']['goods_name']; ?>"/>
        <span></span>

        <p class="hint"><?php echo $lang['store_goods_index_goods_name_help']; ?></p>
    </dd>
</dl>
<script>
    var elem = document.getElementById('goods_name');
    if (document.addEventListener) {
        elem.addEventListener('input', function () {
            var val = elem.value;
            var x = 50 - val.length;
            $(elem).next().text('   （还可以录入' + x + '字）');
        })
    } else {
        elem.attachEvent('onpropertychange', function () {
            var e = window.event;
            if (e.propertyName == 'value') {
                var val = elem.value;
                var x = 50 - val.length;
                $(elem).next().text('   （还可以录入' + x + '字）');
            }
        });
    }
</script>
<dl>
    <dt>
        <i class="required">*</i>
        产品条形码：
    </dt>
    <dd nc_type="no_spec">
        <input name="sharp" value="<?php echo $output['goods']['sharp']; ?>" type="text" class="text w180">
        <span></span>

        <p class="hint"></p>
    </dd>
</dl>
<dl>
    <dt>商品卖点<?php echo $lang['nc_colon']; ?></dt>
    <dd>
        <textarea name="g_jingle" class="textarea h60 w400"><?php echo $output['goods']['goods_jingle']; ?></textarea>
        <span></span>

        <p class="hint">商品卖点最长不能超过140个汉字</p>
    </dd>
</dl>

<dl>
    <dt nc_type="no_spec"><i
            class="required">*</i><?php echo $lang['store_goods_index_store_price'] . $lang['nc_colon']; ?></dt>
    <dd nc_type="no_spec">
        <?php
            $package = ml('goods_package')->find($output['goods_info']['goods_id']);
            if(!is_array($package) || !$output['goods_info']['goods_id']){
        ?>
        <input name="g_price" value="<?php echo $output['goods']['goods_price']; ?>" type="text" class="text w60"/><em class="add-on"><i class="icon-renminbi"></i></em> <span></span>
        <?php }else{ ?>
                <input name="g_price" value="<?php echo $output['goods']['goods_price']; ?>" type="hidden">
                <input value="<?php echo $output['goods_info']['goods_price']; ?>" type="text" class="text w60" style="background:#E6E6E6" disabled /><em class="add-on"><i class="icon-renminbi"></i></em> <span></span>
            <?php } ?>

        <p class="hint"><?php echo $lang['store_goods_index_store_price_help']; ?>，且不能高于市场价。<br>
            此价格为商品实际销售价格。</p>
        <p class="hint-tax" style="display: none">价格必须是0.01~<?php echo $config['tax_goods_max_price']; ?>之间的数字，且不能高于市场价。<br>  此价格为商品实际销售价格。</p>
    </dd>
</dl>


<dl>
    <dt nc_type="no_spec"><i class="required">*</i>商品净重：</dt>
    <dd nc_type="no_spec">
        <input name="weight" value="<?php echo $output['goods']['weight']; ?>" type="text" class="text w60"/><em
            class="add-on">克</em> <span></span>

        <p class="hint">单位为g，请填写大于0的整数</p>
    </dd>
</dl>


<dl>
    <dt><i class="required">*</i>市场价<?php echo $lang['nc_colon']; ?></dt>
    <dd>
        <input name="g_marketprice" value="<?php echo $output['goods']['goods_marketprice']; ?>" type="text"
               class="text w60"/><em class="add-on"><i class="icon-renminbi"></i></em> <span></span>

        <p class="hint"><?php echo $lang['store_goods_index_store_price_help']; ?>，此价格仅为市场参考售价，请根据该实际情况认真填写。</p>
        <p class="hint-tax" style="display: none">价格必须是0.01~<?php echo $config['tax_goods_max_price']; ?>之间的数字，此价格仅为市场参考售价，请根据该实际情况认真填写。</p>
    </dd>
</dl>
<dl>
    <dt>成本价<?php echo $lang['nc_colon']; ?></dt>
    <dd>
        <input name="g_costprice" value="<?php echo $output['goods']['goods_costprice']; ?>" type="text"
               class="text w60"/><em class="add-on"><i class="icon-renminbi"></i></em> <span></span>

        <p class="hint">价格必须是0.00~9999999之间的数字，此价格为商户对所销售的商品实际成本价格进行备注记录，非必填选项，不会在前台销售页面中显示。</p>
        <p class="hint-tax" style="display:none;"> 价格必须是0.01~<?php echo $config['tax_goods_max_price']; ?>之间的数字，此价格为商户对所销售的商品实际成本价格进行备注记录，非必填选项，不会在前台销售页面中显示。 </p>
    </dd>
</dl>

<?php if($output['store_info']['is_whole'] == "1"){ ?>
<!--批发 - begin -->
<dl >
    <dt>参与批发</dt>
    <dd>
        <input type="checkbox" name="is_whole" <?php if($output['goods_info']['is_whole']){ echo "checked"; }?> id="open-whole"/>
        <p class="hint">是否开启商品批发</p>
    </dd>
</dl>
<dl class="goods-whole" style="background:#eee;display: none">
    <dt>批发价</dt>
    <dd>
        <input name="whole_price" value="<?php echo $output['goods_info']['whole_price']; ?>" type="text"
               class="text w60"/><em class="add-on"><i class="icon-renminbi"></i></em> <span></span>
        <p class="hint">价格必须是0.00~9999999之间的数字</p>
    </dd>
</dl>
<dl class="goods-whole" style="background:#eee;display: none">
    <dt>起批量</dt>
    <dd>
        <input name="whole_min" value="<?php echo $output['goods_info']['whole_min']; ?>" type="text" class="text w60"/>
    </dd>
</dl>
<!--批发 - end -->
<script>
    $('#open-whole').click(function () {
        if (this.checked) {
            $('.goods-whole').slideDown();
        }  else {
            $('.goods-whole').slideUp();
        }
    });
    if($("#open-whole").prop("checked")){
        $('.goods-whole').show();
    }
</script>
<?php } ?>


<dl style='display: none;'>
    <dt>折扣<?php echo $lang['nc_colon']; ?></dt>
    <dd>
        <input name="g_discount" value="<?php echo $output['goods']['goods_discount']; ?>" type="text" class="text w60"
               readonly="readonly" style="background:#E7E7E7 none;"/><em class="add-on">%</em>

        <p class="hint">根据销售价与市场价比例自动生成，不需要编辑。</p>
    </dd>
</dl>
<?php if (is_array($output['spec_list']) && !empty($output['spec_list'])) { ?>
    <?php $i = '0'; ?>
    <?php foreach ($output['spec_list'] as $k => $val) { ?>
        <dl nc_type="spec_group_dl_<?php echo $i; ?>" nctype="spec_group_dl" class="spec-bg"
            <?php if ($k == '1'){ ?>spec_img="t"<?php } ?>>
            <dt>
                <input name="sp_name[<?php echo $k; ?>]" type="text" class="text w60 tip2 tr"
                       title="自定义规格类型名称，规格值名称最多不超过4个字" value="<?php if (isset($output['goods']['spec_name'][$k])) {
                    echo $output['goods']['spec_name'][$k];
                } else {
                    echo $val['sp_name'];
                } ?>" maxlength="4" nctype="spec_name"
                       data-param="{id:<?php echo $k; ?>,name:'<?php echo $val['sp_name']; ?>'}"/>
                <?php echo $lang['nc_colon'] ?></dt>
            <dd <?php if ($k == '1'){ ?>nctype="sp_group_val"<?php } ?>>
                <ul class="spec">
                    <?php if (is_array($val['value'])) { ?>
                        <?php foreach ($val['value'] as $v) { ?>
                            <li><span nctype="input_checkbox">
              <input type="checkbox" value="<?php echo $v['sp_value_name']; ?>"
                     nc_type="<?php echo $v['sp_value_id']; ?>" <?php if ($k == '1'){ ?>class="sp_val"<?php } ?>
                     name="sp_val[<?php echo $k; ?>][<?php echo $v['sp_value_id'] ?>]">
              </span><span nctype="pv_name"><?php echo $v['sp_value_name']; ?></span></li>
                        <?php } ?>
                    <?php } ?>
                    <li data-param="{gc_id:<?php echo $output['goods_class']['gc_id']; ?>,sp_id:<?php echo $k; ?>,url:'<?php echo urlShop('store_goods_add', 'ajax_add_spec'); ?>'}">
                        <div nctype="specAdd1"><a href="javascript:void(0);" class="ncsc-btn" nctype="specAdd"><i
                                    class="icon-plus"></i>添加规格值</a></div>
                        <div nctype="specAdd2" style="display:none;">
                            <input class="text w60" type="text" placeholder="规格值名称" maxlength="20">
                            <a href="javascript:void(0);" nctype="specAddSubmit"
                               class="ncsc-btn ncsc-btn-acidblue ml5 mr5">确认</a><a href="javascript:void(0);"
                                                                                   nctype="specAddCancel"
                                                                                   class="ncsc-btn ncsc-btn-orange">取消</a>
                        </div>
                    </li>
                </ul>
                <?php if ($output['edit_goods_sign'] && $k == '1') { ?>
                    <p class="hint">添加或取消颜色规格时，提交后请编辑图片以确保商品图片能够准确显示。</p>
                <?php } ?>
            </dd>
        </dl>
        <?php $i++; ?>
    <?php } ?>
<?php } ?>
<dl nc_type="spec_dl" class="spec-bg" style="display:none; overflow: visible;">
    <dt><?php echo $lang['srore_goods_index_goods_stock_set'] . $lang['nc_colon']; ?></dt>
    <dd class="spec-dd">
        <table border="0" cellpadding="0" cellspacing="0" class="spec_table">
            <thead>
            <?php if (is_array($output['spec_list']) && !empty($output['spec_list'])) { ?>
                <?php foreach ($output['spec_list'] as $k => $val) { ?>
                    <th nctype="spec_name_<?php echo $k; ?>"><?php if (isset($output['goods']['spec_name'][$k])) {
                            echo $output['goods']['spec_name'][$k];
                        } else {
                            echo $val['sp_name'];
                        } ?></th>
                <?php } ?>
            <?php } ?>
            <th class="w90"><span class="red">*</span>市场价
                <div class="batch"><i class="icon-edit" title="批量操作"></i>

                    <div class="batch-input" style="display:none;">
                        <h6>批量设置价格：</h6>
                        <a href="javascript:void(0)" class="close">X</a>
                        <input name="" type="text" class="text price"/>
                        <a href="javascript:void(0)" class="ncsc-btn-mini" data-type="marketprice">设置</a><span
                            class="arrow"></span></div>
                </div>
            </th>
            <th class="w90"><span class="red">*</span><?php echo $lang['store_goods_index_price']; ?>
                <div class="batch"><i class="icon-edit" title="批量操作"></i>

                    <div class="batch-input" style="display:none;">
                        <h6>批量设置价格：</h6>
                        <a href="javascript:void(0)" class="close">X</a>
                        <input name="" type="text" class="text price"/>
                        <a href="javascript:void(0)" class="ncsc-btn-mini" data-type="price">设置</a><span
                            class="arrow"></span></div>
                </div>
            </th>
            <th class="w60"><span class="red">*</span><?php echo $lang['store_goods_index_stock']; ?>
                <div class="batch"><i class="icon-edit" title="批量操作"></i>

                    <div class="batch-input" style="display:none;">
                        <h6>批量设置库存：</h6>
                        <a href="javascript:void(0)" class="close">X</a>
                        <input name="" type="text" class="text stock"/>
                        <a href="javascript:void(0)" class="ncsc-btn-mini" data-type="stock">设置</a><span
                            class="arrow"></span></div>
                </div>
            </th>
            <th class="w70">预警值
                <div class="batch"><i class="icon-edit" title="批量操作"></i>

                    <div class="batch-input" style="display:none;">
                        <h6>批量设置预警值：</h6>
                        <a href="javascript:void(0)" class="close">X</a>
                        <input name="" type="text" class="text stock"/>
                        <a href="javascript:void(0)" class="ncsc-btn-mini" data-type="alarm">设置</a><span
                            class="arrow"></span></div>
                </div>
            </th>
            <th class="w100"><?php echo $lang['store_goods_index_goods_no']; ?></th>
            </thead>
            <tbody nc_type="spec_table">
            </tbody>
        </table>
        <p class="hint">点击<i class="icon-edit"></i>可批量修改所在列的值。</p>
    </dd>
</dl>
<dl>
    <dt nc_type="no_spec"><i
            class="required">*</i><?php echo $lang['store_goods_index_goods_stock'] . $lang['nc_colon']; ?></dt>
    <dd nc_type="no_spec">
        <input name="g_storage" value="<?php echo $output['goods']['g_storage']; ?>" type="text" class="text w60"/>
        <span></span>

        <p class="hint"><?php echo $lang['store_goods_index_goods_stock_help']; ?></p>
    </dd>
</dl>
<dl style='display: none;'>
    <dt>库存预警值<?php echo $lang['nc_colon']; ?></dt>
    <dd>
        <input name="g_alarm" value="<?php echo $output['goods']['goods_storage_alarm']; ?>" type="text"
               class="text w60"/>
        <span></span>

        <p class="hint">设置最低库存预警值。当库存低于预警值时商家中心商品列表页库存列红字提醒。<br>
            请填写0~255的数字，0为不预警。</p>
    </dd>
</dl>
<dl>
    <dt nc_type="no_spec"><?php echo $lang['store_goods_index_goods_no'] . $lang['nc_colon']; ?></dt>
    <dd nc_type="no_spec">
        <p>


            <input name="g_serial" value="<?php echo $goods_info['goods_serial']; ?>" type="text" class="text"/>
        </p>

        <p class="hint">
            商家货号是指商家管理商品的编号<Br>
            最多可输入20个字符，支持输入中文、字母、数字、_、/、-和小数点
        </p>
    </dd>
</dl>
<dl>
    <dt><i class="required">*</i><?php echo $lang['store_goods_album_goods_pic'] . $lang['nc_colon']; ?></dt>
    <dd>
        <div class="ncsc-goods-default-pic">
            <div class="goodspic-uplaod">
                <div class="upload-thumb"><img nctype="goods_image" src="<?php echo thumb($output['goods'], 240); ?>"/>
                </div>
                <input type="hidden" name="image_path" id="image_path" nctype="goods_image"
                       value="<?php echo $output['goods']['goods_image'] ?>"/>
                <span></span>

                <p class="hint"><?php echo $lang['store_goods_step2_description_one']; ?><?php printf($lang['store_goods_step2_description_two'], intval(C('image_max_filesize')) / 1024); ?></p>

                <div class="handle">
                    <div class="ncsc-upload-btn"><a href="javascript:void(0);"><span>
                  <input onchange='return file_upload(this)' type="file" hidefocus="true" size="1" class="input-file"
                         name="goods_image" id="goods_image">
                  </span>
                            <script>
                                function file_upload(t) {
                                    // console.log(t)
                                    // if(t.files){
                                    //   var file = t.files[0];
                                    //   if(file.size > 1024 * 1024){
                                    //       layer.msg('文件过大，请重新上传！');
                                    //       setTimeout(function(){
                                    //         $('[nctype=goods_image]').attr('src','/data/upload/shop/common/default_goods_image_240.gif')
                                    //       },50)
                                    //   }

                                    // }
                                    // return false;
                                }
                            </script>
                            <p><i class="icon-upload-alt"></i>图片上传</p>
                        </a></div>
                    <a class="ncsc-btn mt5" nctype="show_image"
                       href="<?php echo urlShop('store_album', 'pic_list', array('item' => 'goods')); ?>"><i
                            class="icon-picture"></i>从图片空间选择</a> <a href="javascript:void(0);" nctype="del_goods_demo"
                                                                    class="ncsc-btn mt5" style="display: none;"><i
                            class="icon-circle-arrow-up"></i>关闭相册</a></div>
            </div>
        </div>
        <div id="demo"></div>
    </dd>
</dl>